﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using DBSystem.BussinesEntities;

namespace DBSystem.Repository.Mapping
{
    public class PreferenciaMap:EntityTypeConfiguration<Preferencia>
    {
        public PreferenciaMap()
        { 
            //key
            this.HasKey(p => p.Id);

            //propiedades
            this.Property(p => p.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(p => p.Descripcion)
                .HasMaxLength(200)
                .IsRequired();

            this.Ignore(p => p.IsSelect);

            //table
            this.ToTable("Preferencia");
        }
    }
}